# coding=utf-8
# 代码文件：chapter6/ch6.2.6.py

import matplotlib.pyplot as plt
import pandas as pd

plt.rcParams['font.family'] = ['SimHei']  # 设置中文字体
plt.rcParams['axes.unicode_minus'] = False  # 设置负号显示

plt.figure(figsize=(15, 5))

f = r'data\股票历史交易数据.xlsx'
df = pd.read_excel(f)

df2 = df.query("Date >='2021-03-01' and Date < '2021-04-01'").sort_values(by='Date')

# 绘制线段
plt.plot(df2['Date'], df2['Volume'])

plt.title('贵州茅台股票')
plt.ylabel('成交量')                   # 添加y轴标题
plt.xlabel('交易日期')                 # 添加x轴标题
plt.xticks(rotation=40)
plt.show()
